# -----------------------------------------------
# Author: yuz
# Copyright: 湖南零檬信息技术有限公司
# Email: wagyu2016@163.com
# Phone&Wechat: 18173179913
# Site: http://www.lemonban.com
# Forum: http://testingpai.com
# -----------------------------------------------
# pip intall jsonpath
import requests
import jsonpath


def get_product(product_id):
    """获取 product, 2131"""
    url = 'http://mall.lemonban.com:8107/prod/prodInfo'
    response = requests.request(method='get',
                                url=url,
                                params={'prodId': product_id})
    content = response.json()
    print(content)
    return content


if __name__ == '__main__':
    json_dict = get_product(2131)
    # json_dict['skuList'][0]['skuId']
    result = jsonpath.jsonpath(json_dict, '$..skuId')[0]
    print(result)
